<?php
require_once('conn.inc.php');
@$conn		=		mysql_connect($db_host,$db_user,$db_pwd);
mysql_query("set names 'utf8'");
mysql_select_db($db_name);

@$six	=	6;
@$t = $_POST['t'];
if ($t==null) {
	$t=0;
}

@$select	=	"select * from home where state='1' order by id desc LIMIT $t,$six"; //LIMIT 0,10
$rs			= mysql_query($select);

// while ($row=mysql_fetch_array($rs)){
// 	$y	=	$row['hid'];
// 	$y1	=	"select * from hometeam where hid = $y && state=1";
// 	$y2	= mysql_query($y1);
// 	$y3	= mysql_num_rows($y2);
// }

@$sql		=	"select * from home where state='1'";
$r			= mysql_query($sql);

$totalrows	= mysql_num_rows($r);		//总条数
$totalpage	= ceil($totalrows/$six);		//页码

$results = array('totalrows'=>$totalrows,'totalpage'=>$totalpage);
while ($xx = mysql_fetch_assoc($rs)) {
	$results['data'][] = $xx;
}

// 将数组转成json格式
echo json_encode($results);
mysql_close();
